<?php
include('../Lib/php/conex.php');
$link= conectaSQL("influenza","inf123456","influenza");
include('../Lib/php/fechas.php');
include('../Lib/php/funciones.php');
import_request_variables("g,P");
$dHoy = date("Ymd H:i:s");
$tabla ="aux_viajes";



	$accion = 1;	
	// Construye nombres de campos 
	$insert = "INSERT INTO $tabla (";
	$valores = " VALUES (";
	$query = mssql_query("select * from $tabla",$link);
	while($field = mssql_fetch_field($query)){
		$cCampo = $field->name;
		if($field->type == "char" or $field->type == "datetime") $com = "'"; else $com = "";
		foreach($_GET as $valor => $x){
			$campoValor = "$".$cCampo;
			eval("\$campoValor = \"$campoValor\";");
			if($cCampo == $valor and $campoValor != ''){
				$insert .= $cCampo.",";
				if($field->type == "datetime")
					$valores .= $com.formatofecha($campoValor)."$com,";
				else
					$valores .= $com.$campoValor."$com,";
			}
		}
	}
	$insert .= " fCreacion)";
	$valores .= "'$dHoy')";		
	$sql = $insert.$valores;

//echo $sql;
//die();
$ejecutaQuerys = mssql_query($sql,$link) or die(mssql_get_last_message());



include("listaviajes.php");
?>


